/**
 * This file is part of Adaptools.
 * 
 * Adaptools is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Adaptools is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 * along with Adaptools.  If not, see http://www.gnu.org/licenses/. 
 */
package org.adaptools.core;

import java.util.Map;

import org.adaptools.base.MechanismState;
import org.adaptools.base.exception.AdaptoolsException;
import org.adaptools.filecontroler.impl.AdaptoolsFileType;

/**
 * Interface to AdaptoolsCore
 * 
 * @author Denys G. Santos (gsdenys@gmail.com)
 * @since 3.0.0
 */
public interface AdaptoolsCore {

	/**
	 * Load an Adaptools project
	 * 
	 * Using the file path this method load the Adaptools project and populate
	 * the repository that will be used as part of automata execution
	 * 
	 * @param prjFilePath
	 * @throws AdaptoolsException
	 */
	public void load(String prjFilePath) throws AdaptoolsException;

	/**
	 * Load an Adaptools project
	 * 
	 * Using a map of file path this method load the Adaptools project and
	 * populate the repository that will be used as part of automata execution
	 * 
	 * @param mapOfFilePath
	 * @throws AdaptoolsException
	 */
	public void load(Map<AdaptoolsFileType, String> mapOfFilePath)
			throws AdaptoolsException;

	/**
	 * Execute Automata
	 * 
	 * Method to execute automata in continuous mode. This method use a wait
	 * time (in milliseconds) between the transitions execute
	 * 
	 * @param waitTime
	 *            (in milliseconds)
	 * @throws AdaptoolsException
	 */
	public void execute(Integer waitTime) throws AdaptoolsException;

	/**
	 * Debug Automata
	 * 
	 * Method to debug automata. In this method the automata is not executed as
	 * continuous mode, it's needed to a next function call to each transition,
	 * this way the user will execute the transition itself, different to the
	 * method {@link AdaptoolsCore#execute(Integer)}
	 * 
	 * @throws AdaptoolsException
	 */
	public void debug() throws AdaptoolsException;

	/**
	 * Execute a next transition of automata
	 * 
	 * @throws AdaptoolsException
	 */
	public void next() throws AdaptoolsException;

	/**
	 * Return the status of automata execution
	 * 
	 * @return {@link MechanismState}
	 * @throws AdaptoolsException
	 */
	public MechanismState status() throws AdaptoolsException;

	/**
	 * Save an Adaptools project
	 * 
	 * Using the file path this method save the Adaptools project to filesystem
	 * 
	 * @param prjFilePath
	 * @throws AdaptoolsException
	 */
	public void save(String prjFilePath) throws AdaptoolsException;

	/**
	 * Save an Adaptools project
	 * 
	 * Using a folder path and a array of {@link AdaptoolsFileType} this method
	 * save the files specified in the array
	 * 
	 * @param mapOfFilePath
	 * @throws AdaptoolsException
	 */
	public void save(String folderPath, AdaptoolsFileType... fileTypeArray)
			throws AdaptoolsException;
}
